import http from "../common/http.js";

export default {
  //新余额接口
  new_recharge_list: (data, needLoading) => {
    return http.GET("/recharge/league-record", data, needLoading);
  },
  //登录接口
  user_login: (data, needLoading) => {
    return http.GET("/passport/login", data, needLoading);
  },
  //修改密码
  edit_passowrd: (data, needLoading) => {
    return http.POST("/passport/edit-password", data, needLoading);
  },
  //手机号授权
  auth_phone: (data, needLoading) => {
    return http.POST("/passport/auth-phone", data, needLoading);
  },
  // 根据code获取openid登录
  login_by_openid: (data, needLoading) => {
    return http.POST("/passport/login-by-openid", data, needLoading);
  },
  // 根据id获取用户信息
  login_by_user_id: (data, needLoading) => {
    return http.POST("/passport/login-by-user-id", data, needLoading);
  },
  //手机号授权 by 支付宝
  auth_phone_alipay: (data, needLoading) => {
    return http.POST("/alipay/passport/phone", data, needLoading);
  },
  //获取user_id授权 by 支付宝
  auth_user_alipay: (data, needLoading) => {
    return http.POST("/alipay/passport/login", data, needLoading);
  },
  auth_user_auth: (data, needLoading) => {
    return http.POST("/alipay/passport/auth", data, needLoading);
  },
  user_member: (data, needLoading) => {
    return http.POSTJSON("/user/member", data, needLoading);
  },
  //记录浏览记录
  browse: (data, needLoading) => {
    return http.GET("/default/browse-list", data, needLoading);
  },
  //获取收货地址
  address_list: (data, needLoading) => {
    return http.GET("/user/address-list", data, needLoading);
  },
  //保存收货地址
  address_save: (data, needLoading) => {
    return http.POSTJSON("/user/address-save", data, needLoading);
  },
  //设置默认收货地址
  address_set_default: (data, needLoading) => {
    return http.GET("/user/address-set-default", data, needLoading);
  },
  //收货地址详情
  address_details: (data, needLoading) => {
    return http.GET("/user/address-detail", data, needLoading);
  },
  //删除收货地址
  address_del: (data, needLoading) => {
    return http.GET("/user/address-delete", data, needLoading);
  },
  //关于我们
  article_detail: (data, needLoading) => {
    return http.GET("/default/article-detail", data, needLoading);
  },
  //用户余额记录
  recharge_list: (data, needLoading) => {
    return http.GET("/recharge/record", data, needLoading);
  },
  //余额明细
  recharge_details: (data, needLoading) => {
    return http.GET("/recharge/detail", data, needLoading);
  },
  //充值可选
  recharges_list: (data, needLoading) => {
    return http.POST("/recharge/list", data, needLoading);
  },
  //余额充值
  recharge_submit: (data, needLoading) => {
    return http.POST("/recharge/submit", data, needLoading);
  },
  //省市区选择项
  get_district: (data, needLoading) => {
    return http.GET("/default/district", data, needLoading);
  },
  //绑定手机号
  user_binding: (data, needLoading) => {
    return http.POST("/user/user-binding", data, needLoading);
  },
  //授权手机号确认
  user_empower: (data, needLoading) => {
    return http.GET("/user/user-empower", data, needLoading);
  },
  // 发送验证码
  sms_code: (data, needLoading) => {
    return http.POST("/passport/send-code", data, needLoading);
  },
  //会员购买
  member_buy: (data, needLoading) => {
    return http.POST("/user/submit-member", data, needLoading);
  },
  //我的收藏列表
  favoriteList: (data, needLoading) => {
    return http.GET("/user/favorite-list", data, needLoading);
  },
  //取消收藏
  removeFavorite: (data, needLoading) => {
    return http.POSTJSON("/user/remove-favorite", data, needLoading);
  },
  // 获取用户余额接口
  getUserAccountMoney: (data) => {
    return http.POST("/store/user-info", data);
  },
  // 修改用户信息
  modifyUserInfo: (data) => {
    return http.POST("/user/edit-user-info", data);
  },
  // 余额转佣金
  switchBonus(data, loading) {
    return http.POST("/user/balance-to-commission", data, loading);
  },
  // 更新用户wechat_app_open_id
  updateUserWechatOpenId: (data, needLoading) => {
    return http.POST("/user/update-wechat-open-id", data, needLoading);
  },
  // h5用code解析openid
  getOpenidByCode(data, loading) {
    return http.POST("/user/code-to-openid", data, loading);
  },
  // 供应链切换商城，用户自动登录
  switchStoreAutoLogin(data, loading) {
    return http.GET("/passport/switch-store-auto-login", data, loading);
  },
  // 充值记录
  rechargeOrder(data, loading) {
    return http.GET("/recharge/recharge-order", data, loading);
  },
  // 充值订单申请退款
  rechargeOrderRefundMoneyApply(data, loading) {
    return http.POST(
      "/recharge/recharge-order-refund-money-apply",
      data,
      loading
    );
  },
  rechargeOrderRefundMoneyList(data, loading) {
    return http.GET(
      "/recharge/recharge-order-refund-money-list",
      data,
      loading
    );
  },
  updateUserWechatAppOpenId(data, loading) {
    return http.POST("/user/update-wechat-app-open-id", data, loading);
  },
  updateMobile(data, loading) {
    return http.POST("/user/update-mobile", data, loading);
  },
  getOptionByH5(data, needLoading) {
    return http.GET("/passport/get-option-by-h5", data, needLoading);
  },

  forgetPassword(data, needLoading) {
    return http.POST("/passport/forget-password", data, needLoading);
  },
  userPasswordRegedit(data, needLoading) {
    return http.POST("/passport/user-password-regedit", data, needLoading);
  }
};

// 积分/余额转赠
export function giveAssets(data, needLoading) {
  return http.POST("/user/give-assets", data, needLoading);
}

// 用户查找
export function searchUser(data, needLoading) {
  return http.GET("/user/search-user", data, needLoading);
}

// 记录
export function getAccountLog(data, needLoading) {
  return http.GET("/user/get-account-log", data, needLoading);
}

// 佣金转余额
export function commissionToBalance(data, needLoading) {
  return http.POST("/user/commission-to-balance", data, needLoading);
}

// 获取手续费
export function getProfit(data, needLoading) {
  return http.GET("/user/get-profit", data, needLoading);
}

// 获取省市区
export function defaultArea(data, needLoading) {
  return http.GET("/default/get-area", data, needLoading);
}

export function addressRecognition(data, needLoading) {
  return http.POSTJSON("/default/address-recognition", data, needLoading);
}
